/*
 * @Description: 
 * @Version: 1.0
 * @Author: tao
 * @Date: 2021-01-20 11:59:16
 * @LastEditors: tao
 * @LastEditTime: 2021-03-24 17:40:24
 */
import {
  request
} from './request'
import store from 'store/index';

export function getDataByPageAndSize(page = 1, size = 10) {
  return request({
    url: `/user/adminList`,
    params: {
      page,
      size,
      type: store.state.type,
      username: store.state.UserId,
    }
  })
}

export function searchById(params) {
  return request({
    url: `/user/adminFind`,
    params
  })
}

export function editData(data) {
  return request({
    url: `/user/adminEdit`,
    method: 'post',
    data: {
      ...data,
      // now: store.state.type
    }
  })
}

export function deleteById(id) {
  return request({
    url: `/user/adminDel?id=${id}&type=${store.state.type}`,
  })
}

export function appendData(data) {
  return request({
    url: `/user/adminAdd`,
    method: 'post',
    data
  })
}

export function initPassword(id) {
  return request({
    url: `/user/userPass?id=${id}`,
  })
}